<template>
	<div class="math-formula-item">
		<div class="formula-item" v-for="(item, index) in list" :key="index" :class="col">
			<div class="item" v-for="(formula, i) in item.formula" :key="i">
				<div v-if="[null, '_'].includes(formula)" class="placeholder"></div>
				<span v-else>{{ formula }}</span>
			</div>
		</div>
	</div>
	
</template>

<script setup>
import { computed } from 'vue';
const props = defineProps({
	data: {
		type: Object,
		default: () => ({})
	},
	categoryItem: {
		type: Object,
		default: () => ({})
	},
})
const list = computed(() => {
	return props.data
})
const col = computed(() => {
	if(props.categoryItem.fourFormula) {
		return props.categoryItem.step > 1 ? 'col-8' : 'col-6'
	}else{
		return 'col-6'
	}
})
</script>

<style lang="scss" scoped>
@import "@/styles/var.scss";
.math-formula-item {
	display: flex;
	flex-wrap: wrap;
	.formula-item {
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 2.2rem 0;
		font-family: "Alimama";
		&.col-8 {
			padding: 1.4rem 0;
		}
	}
	.item {
		text-align: center;
		padding: 0 0.3rem;
	}
	text {
		font-family: "Alimama";
		font-size: 1.2rem;
		line-height: 1;
		font-weight: bold;
	}
	.placeholder {
		width: 100%;
		text-align: center;
		border: 2px solid $gray-ligh-4;
		border-radius: 0.4rem;
		height: 2.6rem;
		width: 3rem;
		box-sizing: border-box;
		font-size: 1.5rem;
		font-family: "Alimama";
		display: flex;
		align-items: center;
		justify-content: center;
		line-height: 1;
		overflow: hidden;
		background-color: #fff;
		transform: translateY(0.5rem);
	}
	.math-formula-result {
		margin-left: 0.4rem;
		font-size: 1.4rem;
	}
}
</style>